package cn;

import java.util.Scanner;
public class Test1 {
    public static void hanoi(int n,char a,char b,char c){
        if(n>1)
        {
            hanoi(n-1,a,c,b);
            System.out.printf("%c->%c",a,c);
            System.out.println();
            hanoi(n-1,b,a,c);
        }
        else
        {
            System.out.printf("%c->%c",a,c);
            System.out.println();
        }
    }
    public static void main(String[] args) {
        int n=5;
        hanoi(n,'A','B','C');
    }











    public static double max(int a,int b)
    {
        if(a<b)
        {
            return b;
        }
        else
        {
            return a;
        }
    }
    public static double max(double a,double b,double c)
    {
        if(a<b)
        {
            if(b>c)
            {
                return b;
            }
            else
            {
                return c;
            }
        }
        else
        {
            if(a>c)
            {
                return a;
            }
            else
            {
                return c;
            }
        }
    }
    public static void main9(String[] args) {
        int a=10;
        int b=5;
        double c=1.2;
        double k=8.5;
        double o=7.4;
        System.out.println("整数最大值为"+max(a,b));
        System.out.println("小数最大值"+max(c,k,o));
    }




    public static double sum(int a,int b)
    {
        return a+b;
    }
    public static double sum(double a,double b,double c)
    {
        return a+b+c;
    }
    public static void main8(String[] args) {
        int a=10;
        int b=20;
        int c=40;
        double i=sum(a,b);
        System.out.println("两个整数之和为"+i);
        double j=sum(a,b,c);
        System.out.println("三个小数之和为"+j);
    }
    public static int max2(int a,int b)
    {
        if(a>=b)
        {
            return a;
        }
        else
        {
            return b;
        }
    }
    public static int max3(int a,int b,int c)
    {
        int i=max2(a,b);
        int j=max2(i,c);
        return j;
    }
    public static void main7(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int c=scanner.nextInt();
        int i=max2(a,b);
        System.out.println("前两个数中最大值为"+i);
        int j=max3(a,b,c);
        System.out.println("三个数中最大值为"+j);
    }





















    public static void main6(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int i=0;
        while(n!=0)
        {
            if(n%2==1)
            {
                i++;
            }
            n=n/2;
        }
        System.out.println(i);
    }
    public static void main5(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        if(a<b)
        {
            int j=a;
            a=b;
            b=j;
        }
        int c=0;
        while(a%b!=0)
        {
            c=a%b;
            a=b;
            b=c;
        }
        System.out.println(b);
    }
    public static void main4(String[] args) {
        int j=1;
        int tmp=1;
        double sum=0;
        while(j<=100)
        {
            sum+=(1.0*tmp)/j;
            tmp=-tmp;
            j++;
        }
        System.out.println(sum);
    }



    public static void main3(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int i=0;
        int tmp=0;
        for(i=0;i<=n;i++)
        {
            int count=0;
            tmp=i;
            while(tmp!=0)
            {
                tmp=tmp/10;
                count++;
            }
            int sum=0;
            int b=i;
            if(count==3) {
                while(b!=0) {
                    sum += Math.pow(b % 10, count);
                    b = b / 10;
                }
                if (sum == i) {
                    System.out.println(i + "是水仙花数");
                }
            }
        }
    }

    public static void main2(String[] args) {
        int n=11;
        int i=0;
        for(i=2;i<=Math.sqrt(n);i++)
        {
            if(n%i==0)
            {
                break;
            }
        }
        if(i>Math.sqrt(n))
        {
            System.out.println(n+"是素数");
        }
    }
    public static void main1(String[] args) {
        int count=0;
        int i=0;
        for(i=1;i<=100;i++)
        {
            if((i%10==9)||(i/10==9))
            {
                count=count+1;
            }
        }
        System.out.println(count);
    }
}
